// 文章相关的操作
import request from '@/utils/request'

// export const reqGetArticles = (channelId, timestamp) => {
//   return request({
//     method: 'get',
//     url: '/v1_1/articles',
//     params: {
//       with_top: 1, // 包含置顶文章
//       channel_id: channelId,
//       timestamp
//     }
//   })
// }

// 获取文章列表，需要传入频道id和时间戳
export const reqGetArticles = (channelId, timestamp) => request.get('/v1_0/articles', {
  params: {
    with_top: 1,
    channel_id: channelId,
    timestamp
  }
})
// 不喜欢的文章接口,传入对应文章的id
export const reqDislikeArticle = target => request.post('/v1_0/article/dislikes', { target })
// 举报文章，传入对应的id
export const reqReportArticle = (target, type) => request.post('/v1_0/article/reports', { target, type })
// 文章详情
export const reqGetArticleInfo = id => request.get(`/v1_0/articles/${id}`)
// 点赞文章
export const reqSetLike = target => request.post('/v1_0/article/likings', { target })
// 取消点赞文章
export const reqDelLike = target => request.delete(`/v1_0/article/likings/${target}`)
// 不喜欢的
export const reqDislike = target => request.post('/v1_0/article/dislikes', { target })
// 取消不喜欢
export const reqCancelDislike = target => request.delete(`/v1_0/article/dislikes/${target}`)
// 获取文章评论
export const reqGetComments = (type, source, offset = '1', limit = 10) => request.get('/v1_0/comments', { params: { type, source, offset, limit } })
// 对评论或者回复进行点赞
export const reqSetGood = target => request.post('/v1_0/comment/likings', { target })
// 对文章进行评论
export const reqSetComment = (target, content, id) => request.post('/v1_0/comments', { target, content, art_id: id })
// 取消对文章的点赞
export const reqDelGood = target => request.delete(`/v1_0/comment/likings/${target}`)
